Lambda Functions with Reduce in Python